1 /* 2 * Copyright (C) 2025 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MEDIAPROVIDER_PDF_JNI_PDFCLIENT_IMAGE_OBJECT_H_ 18 #define MEDIAPROVIDER_PDF_JNI_PDFCLIENT_IMAGE_OBJECT_H_ 19 20 #include <stdint.h> 21 22 #include "cpp/fpdf_scopers.h" 23 #include "fpdfview.h" 24 #include "page_object.h" 25 26 typedef unsigned int uint; 27 28 namespace pdfClient { 29 30 enum class BitmapFormat { 31 Unknown = -1, 32 BGR, 33 BGRA, 34 BGRx, 35 }; 36 37 class ImageObject : public PageObject { 38 public: 39 ImageObject(); 40 41 ScopedFPDFPageObject CreateFPDFInstance(FPDF_DOCUMENT document, FPDF_PAGE page) override; 42 bool UpdateFPDFInstance(FPDF_PAGEOBJECT image_object, FPDF_PAGE page) override; 43 bool PopulateFromFPDFInstance(FPDF_PAGEOBJECT image_object, FPDF_PAGE page) override; 44 45 void* GetBitmapBuffer() const; 46 47 ~ImageObject(); 48 49 size_t width_ = 0; 50 size_t height_ = 0; 51 BitmapFormat bitmap_format_ = BitmapFormat::Unknown; 52 ScopedFPDFBitmap bitmap_; 53 }; 54 55 } // namespace pdfClient 56 57 #endif // MEDIAPROVIDER_PDF_JNI_PDFCLIENT_IMAGE_OBJECT_H_